-- The MIT License (MIT)
-- Copyright (c) 2016 Yanghe Sun

--luacheck: no global
--luacheck: no unused args

local fs      = require("path.fs")
local wzip    = require("wzip")
local luaunit = require("luaunit")

Test_wzip = {}

function Test_wzip:testWzip()
    local test_wzip = wzip("./testcases/test.wzip", fs.tmpdir());
    luaunit.assertEquals(test_wzip.max_cpu_time, 1000);
    luaunit.assertEquals(test_wzip.max_memory, 128 * 1024);
    local datas = {{ "ab1.in", "ab1.out", 10 }, { "ab2.in", "ab2.out", 10 },
                   { "ab3.in", "ab3.out", 10 }, { "ab4.in", "ab4.out", 10 }};
    for _, v in ipairs(datas) do
        v[1] = test_wzip:_Join(v[1]);
        v[2] = test_wzip:_Join(v[2]);
    end
    luaunit.assertEquals(test_wzip.datas, datas);
    test_wzip:Clean();
end
